<template>
  <div class="app-container">
    <el-card v-loading="loading">
      <div slot="header">
        <el-button type="primary" @click="resetForm()">返回</el-button>
      </div>
      <el-form ref="ruleForm" :model="formData" :rules="rules" label-width="120px">
        <el-form-item label="退库时间" prop="">
          <el-date-picker v-model="value1" type="date" placeholder="领用时间"> </el-date-picker>
        </el-form-item>
        <el-form-item label="物料编码" prop="">
          <el-input placeholder="物料编码" />
        </el-form-item>
        <el-form-item label="物料描述" prop="">
          <el-input placeholder="物料描述" />
        </el-form-item>
        <el-form-item label="计划退库数量" prop="">
          <el-input placeholder="计划退库数量" />
        </el-form-item>
        <el-form-item label="实际退库数量" prop="">
          <el-input placeholder="实际退库数量" />
        </el-form-item>
        <el-form-item label="单位" prop="">
          <el-input placeholder="单位" />
        </el-form-item>
        <el-form-item label="项目名称" prop="">
          <el-input placeholder="项目名称" />
        </el-form-item>
        <el-form-item label="单位工程名称" prop="">
          <el-input placeholder="单位工程名称" />
        </el-form-item>
        <el-form-item label="领用批次" prop="">
          <el-input placeholder="领用批次" />
        </el-form-item>
        <el-form-item label="使用地点" prop="">
          <el-input placeholder="使用地点" />
        </el-form-item>
        <el-form-item label="专业类别" prop="">
          <el-input placeholder="专业类别" />
        </el-form-item>
        <el-form-item label="退库人" prop="">
          <el-input placeholder="退库人" />
        </el-form-item>
        <el-form-item label="退库部门" prop="">
          <el-input placeholder="退库部门" />
        </el-form-item>
        <el-form-item>
          <el-button @click="resetForm">关闭</el-button>
          <el-button :loading="loading" type="primary" @click="submitForm('ruleForm')">
            <span v-if="loading">提交中...</span>
            <span v-else>提交</span>
          </el-button>
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
import { getInventoryCheckingDelete,getInventoryCheckingAdd,downExportInventory,importInventory } from '@/api/inventoryManagement.js'
let $this = null
export default {
  name: 'submitForm',
  props: ['btnId', 'id'],
  data () {
    return {
      loading: false,
      formData: {},
      rules: {}
    }
  },
  created () {
    $this = this
  },
  methods: {
    submitForm (formName) {
      $this.$emit('refresh')
      this.$refs[formName].validate((valid) => {
        if (!valid) {
          return $this.$message.error('请完善表单信息')
        }
      })
    },
    resetForm () {
      $this.$emit('closeView')
    }
  }
}
</script>

<style scoped lang="scss">
  .el-input {
    width: 500px;
  }
</style>
